
<?php include_once(dirname(__FILE__) . '/../general/head.php'); ?>

<!-- header -->
<?php include_once(dirname(__FILE__) . '/../general/header.php'); ?>

<?php include_once('left.php'); ?>


<div id="page-wrapper">


    <div class="row">
        <div class="col-lg-12">
            <h1 class="page-header">Cài đặt chung</h1>
        </div>
    </div>

    <?php if (isset($message)) { ?>
        <div class="row">
            <div class="col-lg-12">
                <div class="alert alert-success alert-dismissable">
                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                    <?php echo $message; ?>
                </div>
            </div>
        </div>
    <?php } ?>

    <div class="row">
        <div class="col-lg-12">
            <div class="panel panel-default">
                <div class="panel-body">
                    <div class="col-lg-6">
                        <form method="post" action="<?php echo site_url(get_folder($loggedUser['title']) . '/home/settings'); ?>">
                            <input type="hidden" name="Command" value="Submit" />
                            
                            <h3>Attitude Rating</h3>
                            <table>
                                <tr>
                                    <td width="200px">High score</td>
                                    <td><input type="text" name="att_high_score" value="<?php echo $settings['att_high_score']; ?>" class="form-control" onkeypress="validate(event);" /></td>
                                </tr>
                                <tr>
                                    <td>Medium score</td>
                                    <td><input type="text" name="att_medium_score" value="<?php echo $settings['att_medium_score']; ?>" class="form-control" onkeypress="validate(event);" /></td>
                                </tr>
<!--                                <tr>
                                    <td>Low score</td>
                                    <td><input type="text" name="ef" value="<?php echo $settings['ef']; ?>" class="form-control" onkeypress="validate(event);" /></td>
                                </tr>-->
                            </table>
                            
                            <h3>Performance Rating</h3>
                            <table>
                                <tr>
                                    <td width="200px">Exceptional (%)</td>
                                    <td><input type="text" name="ex" value="<?php echo $settings['ex']; ?>" class="form-control" onkeypress="validate(event);" /></td>
                                </tr>
                                <tr>
                                    <td>High Effective (%)</td>
                                    <td><input type="text" name="he" value="<?php echo $settings['he']; ?>" class="form-control" onkeypress="validate(event);" /></td>
                                </tr>
                                <tr>
                                    <td>Effective (%)</td>
                                    <td><input type="text" name="ef" value="<?php echo $settings['ef']; ?>" class="form-control" onkeypress="validate(event);" /></td>
                                </tr>
                                <tr>
                                    <td>Become Effective (%)</td>
                                    <td><input type="text" name="be" value="<?php echo $settings['be']; ?>" class="form-control" onkeypress="validate(event);" /></td>
                                </tr>
                                <tr>
                                    <td>Need Improvement (%)</td>
                                    <td><input type="text" name="ni" value="<?php echo $settings['ni']; ?>" class="form-control" onkeypress="validate(event);" /></td>
                                </tr>
                            </table>

                            <h3>First Rating</h3>
                            <table>
                                <tr>
                                    <td width="200px">Sales target (%)</td>
                                    <td><input type="text" name="sale_ratio" value="<?php echo $settings['sale_ratio']; ?>" class="form-control" onkeypress="validate(event);" /></td>
                                </tr>
                                <tr>
                                    <td>Knowledge testing (%)</td>
                                    <td><input type="text" name="test_ratio" value="<?php echo $settings['test_ratio']; ?>" class="form-control" onkeypress="validate(event);" /></td>
                                </tr>
                            </table>

                            <h3>Mail configuration</h3>
                            <table>
                                <tr>
                                    <td width="200px">From email</td>
                                    <td><input type="text" name="from_email" value="<?php echo $settings['from_email']; ?>" class="form-control" /></td>
                                </tr>
                                <tr>
                                    <td>From name</td>
                                    <td><input type="text" name="from_name" value="<?php echo $settings['from_name']; ?>" class="form-control" /></td>
                                </tr>
                                <tr>
                                    <td>SMTP security</td>
                                    <td><input type="text" name="smtp_sec" value="<?php echo $settings['smtp_sec']; ?>" class="form-control" /></td>
                                </tr>
                                <tr>
                                    <td>SMTP host</td>
                                    <td><input type="text" name="smtp_host" value="<?php echo $settings['smtp_host']; ?>" class="form-control" /></td>
                                </tr>
                                <tr>
                                    <td>SMTP port</td>
                                    <td><input type="text" name="smtp_port" value="<?php echo $settings['smtp_port']; ?>" class="form-control" /></td>
                                </tr>
                                <tr>
                                    <td>SMTP username</td>
                                    <td><input type="text" name="smtp_username" value="<?php echo $settings['smtp_username']; ?>" class="form-control" /></td>
                                </tr>
                                <tr>
                                    <td>SMTP password</td>
                                    <td><input type="text" name="smtp_password" value="<?php echo $settings['smtp_password']; ?>" class="form-control" /></td>
                                </tr>
<!--                                <tr>
                                    <td>Google application password</td>
                                    <td><input type="text" name="google_app_password" value="<?php echo $settings['google_app_pass']; ?>" class="form-control" /></td>
                                </tr>-->
                            </table>
                            <input type="submit" class="btn btn-primary" value="Lưu thay đổi" />
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>


</div>
<!-- /#page-wrapper -->

<script>
    function validate(evt) {
        var theEvent = evt || window.event;
        var key = theEvent.keyCode || theEvent.which;
        key = String.fromCharCode(key);
        //var regex = /[0-9]|\./;
        var regex = /[0-9]/;
        if (!regex.test(key)) {
            theEvent.returnValue = false;
            if (theEvent.preventDefault)
                theEvent.preventDefault();
        }
    }
</script>

<?php include_once(dirname(__FILE__) . '/../general/footer.php'); ?>